<template>
	<view class="accountInformationContent">
		<commonNavBar title="发布信息"    ></commonNavBar>   
		<view class="centre">
			<z-paging ref="paging" autowire-list-name="noticeList" autowire-query-name="listData">
				<view class="li" v-for="(list, index) in noticeList" :key="index"
					@tap="noticeActive(list.id,list.isAuthority)">
					<view class="float">
						<view class="left">{{ index+1 }}</view>
					</view>
					<view class="dt">{{ list.companyName }}</view>
					<view class="dd">
						<view class="titles">发布标题:</view>
						<text class="value">{{ list.noticeTitle }}</text>
					</view>
					<view class="dd">
						<view class="titles">发布时间:</view>
						<text class="value">{{ formatDate(list.createTime) }}</text>
					</view>
					<view class="dd">
						<view class="titles">发布者:</view>
						<text class="value">{{ list.createBy }}</text>
					</view>
				</view>
			</z-paging>
		</view>
	</view>
</template>

<script>
	import commonNavBar from '@/components/CommonNavBar.vue';
	
	export default {
		components:{
			commonNavBar
		},
		data() {
			return { 
				noticeList: [],
				searchParam: {}
			}
		},
		onReady() {
			this.$refs.paging.reload();
		},
		methods: {
			goBack() {
				uni.navigateBack();
			},
			formatDate(timestamp) {
				const date = new Date(Number(timestamp));
				const year = date.getFullYear();
				const month = (date.getMonth() + 1).toString().padStart(2, '0');
				const day = date.getDate().toString().padStart(2, '0');
				const hours = date.getHours().toString().padStart(2, '0');
				const minutes = date.getMinutes().toString().padStart(2, '0');
				const seconds = date.getSeconds().toString().padStart(2, '0');
				return `${year}-${month}-${day}${hours}:${minutes}:${seconds}`;
			},
			async listData(pageNo, pageSize) {
				try {
					this.searchParam.pageNum = pageNo;
					this.searchParam.pageSize = pageSize;
					const res = await uni.$api.sysNoticeList(this.searchParam);
					this.$refs.paging.complete(res.data.data);
				} catch (error) {
					this.$refs.paging.complete(false);
				}
			},
			noticeActive(id) {
				uni.navigateTo({
					url: '/pages/notice/noticeActive?id=' + id
				})
			}
		}
	}
</script>

<style lang="scss">
	.accountInformationContent {
		background: #F9F9F9;
		height: calc(100vh - 115rpx);

		.upper {
			position: fixed;
			z-index: 1;
			top: 0;
			left: 0;
			width: 100%;

			.title {
				background: url('../../static/img/inspectBg.png');
				background-size: cover;
				width: 100%;
				height: 115rpx;
				line-height: 115rpx;
				position: relative;
				display: flex;
				justify-content: center;

				.arrow {
					position: absolute;
					left: 33rpx;
					top: 50%;
					transform: translate(0%, -50%);
					width: 100rpx;
					height: 100rpx;

					&::before {
						display: block;
						content: "";
						position: absolute;
						top: 50%;
						left: 0%;
						width: 20rpx;
						height: 20rpx;
						border-left: 1px solid #fff;
						border-top: 1px solid #fff;
						transform: translate(0%, -50%) rotate(-45deg);
					}
				}

				text {
					font-size: 30rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					letter-spacing: 1px;
				}

				.screen {
					position: absolute;
					right: 30rpx;
					top: 50%;
					transform: translate(0%, -50%);
					width: 35rpx;
					height: 33rpx;
				}
			}
		}

		.centre {
			margin: 115rpx 0 0 0;
			padding: 0 17.5rpx;
			height: calc(100vh - 280rpx);
			overflow-x: hidden;

			.z-paging-content-fixed {
				padding: 115rpx 0 0 0;
			}

			.li {
				background: linear-gradient(180deg, #FFFFFF 0%, #FFFFFF 100%);
				box-shadow: 0rpx 8rpx 15rpx 0rpx rgba(0, 0, 0, 0.05);
				border-radius: 15rpx;
				padding: 30rpx 30rpx 15rpx 28rpx;
				position: relative;
				margin: 13rpx 20rpx 0;

				.float {
					display: flex;
					// position: relative;
					position: absolute;
					top: 0;
					left: 0;
					width: 100%;

					.left {
						position: absolute;
						top: 0;
						left: 0;
						padding: 0 10rpx;
						height: 46rpx;
						line-height: 46rpx;
						background: linear-gradient(180deg, #5DA1FF 0%, #0054C9 100%);
						border-radius: 11rpx 0rpx 11rpx 0rpx;
						font-size: 18rpx;
						font-family: PingFangSC-Medium, PingFang SC;
						font-weight: 500;
						color: #FFFFFF;
						text-align: center;
					}

					.right {
						position: absolute;
						top: 0;
						right: 0;
						padding: 0 10rpx;
						height: 46rpx;
						line-height: 46rpx;
						background: linear-gradient(180deg, #5DA1FF 0%, #0054C9 100%);
						border-radius: 0rpx 11rpx 0rpx 11rpx;
						font-size: 18rpx;
						font-family: PingFangSC-Medium, PingFang SC;
						font-weight: 500;
						color: #FFFFFF;
						text-align: center;
					}
				}

				.dt {
					font-size: 24rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 1;
					margin: 30rpx 0 14rpx 0;
				}

				.dd {
					display: flex;
					align-items: center;
					justify-content: flex-start;
					font-size: 19rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #666666;
					margin: 12rpx auto;


					.titles {
						margin: 0 20rpx 0 0;

					}

					.value {
						width: 450rpx;
						white-space: nowrap;
						text-overflow: ellipsis;
						overflow: hidden;
					}
				}
			}
		}

		.popupContent {
			background: #FFFFFF;
			border-radius: 20rpx 20rpx 0 0;

			.uni-datetime-picker {
				width: 100%;
			}

			.title {
				width: 100%;
				height: 80rpx;
				line-height: 80rpx;
				background: url('../../static/img/popupTitle.png') no-repeat center center;
				background-size: cover;
				font-size: 25rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				text-indent: 45rpx;
			}

			.ul {

				.li {
					padding: 0 45rpx;
					margin: 0 auto;
					display: flex;
					justify-content: space-between;
					align-items: center;
					height: 68rpx;
					line-height: 68rpx;
					border-bottom: 1px solid #d6d6d6;

					.left {
						font-size: 21rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #333333;
					}

					.right {

						input {
							font-size: 21rpx;
							font-family: PingFangSC-Regular, PingFang SC;
							font-weight: 400;
							color: #999999;
							width: 460rpx;
							text-indent: 20rpx;
						}

						.placeholder-class {
							color: #999999;
						}

						.uni-stat__select {
							width: 460rpx;

							/deep/.uni-select {
								border: none;
							}
						}

						.uni-date {
							width: 460rpx;

							/deep/.uni-date-editor--x {
								border: none;
							}
						}
					}

					&:nth-child(odd) {
						background: #F9F9F9;
					}

					&:last-child {
						border-bottom: none;
					}
				}

				.li:last-child {
					/deep/.uni-select__selector {
						top: initial;
					}

					/deep/.uni-popper__arrow {
						display: none;
					}
				}
			}

			.button {
				margin: 58rpx auto 0;
				padding: 0 95rpx 24rpx 95rpx;
				display: flex;

				button {
					width: 269rpx;
					height: 55rpx;
					line-height: 55rpx;
					background: #0552A9;
					border-radius: 10rpx;
					font-size: 20rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;

					&.determine {
						color: #fff;
					}

					&.cancellation {
						background: none;
						border: 1rpx solid #979797;
						color: #979797;
					}
				}
			}
		}
	}
</style>